home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Source Code / C / Applications / Portable Patmos / src / portable kernel / mac / dirent.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-11-05  |  503 b   |  24 lines  |  [TEXT/KAHL]

  1. #include <dirent.h>
  2. #include <stdio.h>
  3.  
  4. _main(int argc, char **argv)
  5.     {
  6.     int loop = 1;
  7.     DIR    *f = opendir(".");
  8.     do
  9.         {
  10.         struct dirent *buf = readdir(f);
  11.         if (buf)
  12.             {
  13.             printf("Entry no = %d ", buf->d_fileno);    /* file number of entry */
  14.             printf("Length = %d ", buf->d_reclen);    /* length of this record */
  15.             printf("name length %d ", buf->d_namlen);    /* length of string in d_name */
  16.             printf("name %s\n", buf->d_name);
  17.             fflush(stdout);
  18.             }
  19.         else loop = 0;
  20.         }
  21.     while (loop);
  22.     closedir(f);
  23.     }
  24.